<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:url('Spu/index')}">商品管理</a></li>
			<li><a href="{:url('Spu/add')}">商品添加</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('Spu/addPost')}">
			<div class="form-group">
				<label for="input-image" class="col-sm-2 control-label">封面</label>
				<div class="col-md-6 col-sm-10">

					<input id="photo-1" type="hidden" name="image" >
					<input id="photo-1-name" type="text" name="photo_name" title="图片名称" disabled readonly>
					<img id="photo-1-preview" width="40px" >
					<div></div>
					<a class="btn btn-primary" href="javascript:uploadOneImage('图片上传','#photo-1');">上传</a>
				</div>
			</div>
			<div class="form-group">
				<label for="input-text" class="col-sm-2 control-label">商品名称添加</label>
				<div class="col-md-6 col-sm-10">
					<textarea class="form-control" name="name" id="input-text" ></textarea>
				</div>
			</div>


			<div class="form-group">
				<label class="col-sm-2 control-label">图集</label>
				<div class="col-md-6 col-sm-10">
					<div id="imagesContainer"></div>
					<div class="margin-top-10">
						<a class="btn btn-default" href="javascript:uploadMultiImage('图片上传','#imagesContainer','photos-item-wrapper');">选择图片</a>
					</div>
				</div>
			</div>

			<div class="form-group">
				<label  class="col-sm-2 control-label">选择分类</label>
				<div class="col-md-6 col-sm-10">
					<select name="gid" id="" class="form-control">
						<option value="">请选择分类</option>
						<foreach name="spu" item="vo">
							<option value="{$vo.id}">{$vo.name}</option>
						</foreach>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label  class="col-sm-2 control-label">状态</label>
				<div class="col-md-6 col-sm-10">
					<label class="radio-inline">
						<input type="radio" name="status" value="0">无货
					</label>
					<label class="radio-inline">
						<input type="radio" name="status" value="1">正常
					</label>
					<label class="radio-inline">
						<input type="radio" name="status" value="2">下架
					</label>
				</div>
			</div>

			<div class="form-group">
				<label  class="col-sm-2 control-label">是否自营</label>
				<div class="col-md-6 col-sm-10">
					<label class="radio-inline">
						<input type="radio" name="zy" value="0">自营
					</label>
					<label class="radio-inline">
						<input type="radio" name="zy" value="1">旗舰店
					</label>
				</div>
			</div>
			<div class="form-group">
				<label  class="col-sm-2 control-label">运费</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control"  name="rmb">
				</div>
			</div>

<!--			<div class="form-group">-->
<!--				<label for="input-description" class="col-sm-2 control-label">链接添加</label>-->
<!--				<div class="col-md-6 col-sm-10">-->
<!--					<textarea class="form-control" name="url" id="input-description" ></textarea>-->
<!--				</div>-->
<!--			</div>-->
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
					<a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
				</div>
			</div>
		</form>
	</div>
	<script src="__STATIC__/js/admin.js?v={$_static_version}"></script>
	<script type="text/html" id="photos-item-wrapper">
		<div style="display: flex;align-items: center;border: 1px solid #ddd;padding: 5px;margin-top: 10px;">
			<div><img id="photo-{id}-preview" src="{url}" class="img-thumbnail" style="width: 100px;height: 50px;"></div>
			<div style="margin-left: 10px;">{name}</div>
			<input id="photo-{id}" type="hidden" name="images[]" value="{filepath}">
		</div>
	</script>
</body>
</html>
